using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;

namespace Identity.Models;

[Table("Navigations")]
public class  Navigation
{
    /// <summary>
    /// 获得/设置 菜单主键ID
    /// </summary>
    [NotNull]
    [Key]
    [StringLength(100)]
    public string? Id { set; get; }=Guid.NewGuid().ToString();

    /// <summary>
    /// 获得/设置 父级菜单ID 默认为 0
    /// </summary>
    
    [StringLength(100)]
    public string ParentId { set; get; } = string.Empty;

    /// <summary>
    /// 获得/设置 菜单名称
    /// </summary>
    [Display(Name = "名称")]
    [NotNull]
    [StringLength(100)]

    public string? Name { get; set; }

    /// <summary>
    /// 获得/设置 菜单序号
    /// </summary>
    [Display(Name = "序号")]
    public int Order { get; set; }

    /// <summary>
    /// 获得/设置 菜单图标
    /// </summary>
    [StringLength(100)]
    [Display(Name = "图标")]
    public string? Icon { get; set; }

    /// <summary>
    /// 获得/设置 菜单URL地址
    /// </summary>
    [NotNull]
    [Display(Name = "地址")]
    [StringLength(255)]
    public string? Url { get; set; }

    /// <summary>
    /// 获得/设置 菜单分类, 0 表示系统菜单 1 表示用户自定义菜单
    /// </summary>
    [Display(Name = "类别")]
    public EnumNavigationCategory Category { get; set; }
    /// <summary>
    /// 获得/设置 链接目标
    /// </summary>
    [Display(Name = "目标")]
    [StringLength(255)]
    public string? Target { get; set; }

    /// <summary>
    /// 获得/设置 是否为资源文件, 0 表示菜单 1 表示资源 2 表示按钮
    /// </summary>
    [Display(Name = "类型")]
    public EnumResource IsResource { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public bool HasChildren { get; set; }

    public string? Application {get;set;}   

    [InverseProperty("Navigation")]
    public virtual ICollection<NavigationRole> NavigationRoles { get; set; } = new List<NavigationRole>();
}